<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>冰心管理平台</title>
    <%@ include file="/WEB-INF/pages/commons/head-meta.jsp" %>
    <%@ include file="/WEB-INF/pages/commons/js-meta.jsp" %>
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->
    <script>if (window.top !== window.self) {
        window.top.location = window.location;
    }</script>
</head>

<body class="gray-bg">
<div class="middle-box text-center loginscreen  animated fadeInDown">
    <div>
        <div style="width: 800px;">
            <h1 class="logo-name" style="margin-left: -500px;">冰心</h1>
        </div>
        <h3>欢迎使用冰心管理平台</h3>
        <form id="loginfrom" method="post" action="${ctx}/admin/login" class="m-t" role="form">
            <div class="form-group">
                <input type="text" class="form-control" name="account" id="account"  AUTOCOMPLETE="off" placeholder="请输入账号...">
            </div>
            <div class="form-group">
                <input type="password" class="form-control" name="password" id="password"  AUTOCOMPLETE="off" placeholder="请输入密码...">
            </div>
            <button type="button" class="btn btn-primary block full-width m-b login" onclick="login()">登 录</button>
        </form>
    </div>
</div>

</body>
<script type="text/javascript">
    $(function () {
        var msg = "${msg}";
        if (msg != "") {
            layer.msg(msg, {icon: 2});
        }
    });

    document.onkeyup = function (e) {
        if (e == null) {
            _key = event.keyCode;
        } else { // firefox              //获取你按下键的keyCode
            _key = e.which;          	 //每个键的keyCode是不一样的
        }
        if (_key == 13) {  				 //判断keyCode是否是13，也就是回车键(回车的keyCode是13)
            login();
        }
    };

    function login() {
        var account = $.trim($("input[name='account']").val());
        var password = $.trim($("input[name='password']").val());
        if (account == "" && password == "") {
            layer.msg("请输入用户名和密码!");
            return false;
        }
        if (account == "") {
            layer.msg("请输入用户名");
            return false;
        }
        if (password == "") {
            layer.msg("请输入密码");
            return false;
        }
        $("#loginfrom").submit();
    }
</script>

</html>
